#include<bits/stdc++.h>
#define int long long
#define endl "\n"

using namespace std;

signed main() {
	int n, r;
	cin >> n >> r;
	while(n -- ) {
		int op, va;
		cin >> op >> va;
		if(op == 1 && r >= 1600 && r <= 2799 ) {
			r += va;
		} 
		if(op == 2 && r >= 1200 && r <= 2399 ) {
			r += va;
		}
	} 	
	cout << r << endl;
	return 0;
}

